package com.qujia.station.controller;

import com.qujia.common.core.domain.ResultData;
import com.qujia.station.domain.GradeQrSetting;
import com.qujia.station.service.IGradeQrSettingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotBlank;

/**
 * @date 2024/1/16
 */
@RestController
@RequestMapping("/gradeQrSetting")
@Api( tags = "会员等级二维码")
public class GradeQrSettingController {

    @Autowired
    private IGradeQrSettingService gradeQrSettingService;

    @GetMapping("query")
    @ApiOperation(value = "查询")
    public ResultData<GradeQrSetting> querySetting(@RequestParam @Validated @NotBlank @ApiParam("等级code") String gradeCode){
        return ResultData.success(gradeQrSettingService.querySetting(gradeCode));
    }

    @PostMapping("save")
    @ApiOperation(value = "保存")
    public ResultData<GradeQrSetting> saveSetting(@RequestBody @Validated GradeQrSetting setting){
        return ResultData.success(gradeQrSettingService.saveSetting(setting));
    }

}
